$(function(){

	search();

});

function infoInsert(){
	$.ajax({
		url:"/dlFocusInfo/infoInsert",
		type:"get",
		dataType:"text",
		contentType : 'application/json',
	    success : function(data){
	    	alert("入库成功")
	    	window.location.reload();
	    },
	    error : function(e){
	    	console.log(e)
	    	alert("连接错误")
	    }
	})
}
function search(){
	var searchParam = JSON.stringify({
		filename:$("#fileName").val(),
		startTime:$("#startTime").val(),
		endTime:$("#endTime").val(),
		pageNum:$("#pageNum").val(),
		pageSize:$("#pageSize").val()
	});

	$.ajax({
        url : "/dlZipFile/dlZipFileList",
        data : searchParam,
        type : 'PATCH',
        dataType : 'json',
        contentType : 'application/json',
        success : successFunc,
        error : errorFunc
    });
}

function successFunc(data) {

	if(data != null){

		var list = data.list;
		var innerHtml= "";
		var fileSize = "";
		var name = "";
		var createTime = "";
		var num = (data.pageNum-1)*data.pageSize;
		$.each(list, function(i, row){
			//createTime = formatJSONDate(row.createTime);
			createTime = row.createTimeStr;
			name = row.name;
			fileSize = row.fileSize;
			innerHtml += "<tr <c:if test='${i%2==0}'> class='odd'</c:if>>" 
							+ "<td algin='center'><span class='entityList'>"+(num+i+1)+"</td>"
							+ "<td algin='center'><span class='entityList'>"+name+"</td>"
							+ "<td algin='center'><span class='entityList'>"+fileSize+"</td>"
							+ "<td algin='center'><span class='entityList'>"+createTime+"</td>"
						+ "</tr>"
			createtime = "";
			name = "";
			fileSize = "";
			
		})

		$("#msg").html(innerHtml);
		
		//加载分页
		pageHelper(data.pageNum,data.lastPage);
	}else{

		alert("获取数据失败！");
	}
}
function errorFunc(data) {
	debugger;
	alert("获取数据失败！");
}
